//
//  DHS2_ProductInfo_BottomCell.m
//  Dresshere
//
//  Created by ZhangPeng on 2018/6/21.
//  Copyright © 2018年 张朋. All rights reserved.
//

#import "DHS2_ProductInfo_BottomCell.h"
#import "DHS2_BrandViewController.h"

@interface DHS2_ProductInfo_BottomCell()

@property (weak, nonatomic) IBOutlet UILabel *brandLabel;
@property (weak, nonatomic) IBOutlet UILabel *noLabel;

@property (strong, nonatomic) NSDictionary *product;

@end

@implementation DHS2_ProductInfo_BottomCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    // 进入品牌页面
    [self.brandLabel bk_whenTapped:^{
        DHS2_BrandViewController *brandController = [[DHS2_BrandViewController alloc] initWithBrandID:[[self.product objectForKey:@"brand"] objectForKey:@"_id"]];
        [self.viewController.navigationController pushViewController:brandController animated:YES];
    }];
}

- (void)updateCell:(NSDictionary *)dic{
    self.product = dic;
    self.brandLabel.text = [NSString removeSpacesAndLinebreaks:[[self.product objectForKey:@"brand"] objectForKey:@"name"]];
    self.noLabel.text = [[[self.product objectForKey:@"brand"] objectForKey:@"_id"] uppercaseString];
    self.noLabel.adjustsFontSizeToFitWidth = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
